﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace DAL
{
    public class InspectorChargeCompany
    {
        public static void insert(InspectorChargeCompanyEntity iccEnt)
        {
            DbHelper.ExecuteNonQuery("[p_InspecterChargeCompany_insert]", iccEnt.adminId, iccEnt.companyId);
        }
        public static void delete(InspectorChargeCompanyEntity iccEnt)
        {
            DbHelper.ExecuteNonQuery("[p_InspecterChargeCompany_Del]", iccEnt.adminId, iccEnt.companyId);
        }
        public static InspectorChargeCompanyEntity getByCompanyId(int companyId)
        {
            InspectorChargeCompanyEntity iccEnt = new InspectorChargeCompanyEntity();
            DataRow dr = DbHelper.ExecuteDataRow("[dbo].[p_InspectorChargeCompany_getByCompanyId]", companyId);
            if (dr != null)
            {
                iccEnt.companyId = companyId;
                iccEnt.iccId = Convert.ToInt32(dr["iccId"]);
                iccEnt.adminId = Convert.ToInt32(dr["adminId"]);
            }
            return iccEnt;
        }
    }
}
